home *** CD-ROM | disk | FTP | other *** search
/ Champak 142 / Volume 142 Oct 17 2011 - Damaged.iso / Games / rapid-fire.swf / scripts / frame_9 / DoAction.as
Text File  |  2011-10-17  |  4KB  |  125 lines

  1. _root.miss_mc.gotoAndStop(6);
  2. _root.InitLevel = function()
  3. {
  4.    var _loc2_ = _root;
  5.    _loc2_.mc_counter = 6000;
  6.    _loc2_.attachMovie("sight_mc","sight_mc",_loc2_.cursor_depth,{_x:_loc2_._xmouse,_y:_loc2_._ymouse});
  7.    _loc2_.sight_mc.startDrag(true,0,0,550,400);
  8.    Mouse.hide();
  9.    _loc2_.sight_mc.cursor._visible = false;
  10.    _loc2_.sight_mc.onMouseDown = function()
  11.    {
  12.       if(this.sight._visible)
  13.       {
  14.          _root.shot_snd.start(0,1);
  15.       }
  16.    };
  17.    _loc2_.timer_mc.gotoAndStop(1);
  18.    var _loc3_ = String(_loc2_.level_num).split("");
  19.    if(_loc3_.length == 1)
  20.    {
  21.       _loc3_.unshift(0,0);
  22.    }
  23.    else if(_loc3_.length == 2)
  24.    {
  25.       _loc3_.unshift(0);
  26.    }
  27.    var _loc1_ = 0;
  28.    while(_loc1_ < 3)
  29.    {
  30.       _loc2_["level_num_" + _loc1_].gotoAndStop(Number(_loc3_[_loc1_]) + 1);
  31.       _loc1_ = _loc1_ + 1;
  32.    }
  33.    _loc2_.goal = _loc2_.level_num * 100 + 200;
  34.    _loc2_.level_win = false;
  35.    _loc1_ = 0;
  36.    while(_loc1_ < 6)
  37.    {
  38.       _loc2_["goal_num_" + _loc1_]._visible = true;
  39.       _loc1_ = _loc1_ + 1;
  40.    }
  41.    _loc2_.got_goal_mc.removeMovieClip();
  42.    _loc2_.ShowScore();
  43. };
  44. _root.ShowScore = function()
  45. {
  46.    var _loc3_ = String(_root.goal).split("");
  47.    var counter = 6 - _loc3_.length;
  48.    var _loc1_ = 0;
  49.    while(_loc1_ < counter)
  50.    {
  51.       _loc3_.unshift(0);
  52.       _loc1_ = _loc1_ + 1;
  53.    }
  54.    _loc1_ = 0;
  55.    while(_loc1_ < 6)
  56.    {
  57.       _root["goal_num_" + _loc1_].gotoAndStop(Number(_loc3_[_loc1_]) + 1);
  58.       _loc1_ = _loc1_ + 1;
  59.    }
  60.    var _loc2_ = String(_root.score).split("");
  61.    var counter = 6 - _loc2_.length;
  62.    _loc1_ = 0;
  63.    while(_loc1_ < counter)
  64.    {
  65.       _loc2_.unshift(0);
  66.       _loc1_ = _loc1_ + 1;
  67.    }
  68.    _loc1_ = 0;
  69.    while(_loc1_ < 6)
  70.    {
  71.       _root["score_num_" + _loc1_].gotoAndStop(Number(_loc2_[_loc1_]) + 1);
  72.       _loc1_ = _loc1_ + 1;
  73.    }
  74. };
  75. _root.InitPlaying = function()
  76. {
  77.    var _loc1_ = _root;
  78.    _loc1_.targets_counter = 0;
  79.    _loc1_.perfect_combo = 0;
  80.    _loc1_.Timer = new TimerControl();
  81.    _loc1_.paused = false;
  82.    _loc1_.onEnterFrame = function()
  83.    {
  84.       var _loc1_ = _root;
  85.       if(!_loc1_.paused)
  86.       {
  87.          if(_loc1_.targets_counter == 0)
  88.          {
  89.             var type = _loc1_.level_num <= 4 ? Math.floor(Math.random() * _loc1_.level_num) + 1 : Math.floor(Math.random() * 5) + 1;
  90.             _loc1_.targets_holder_mc.attachMovie("target_mc","target_" + _loc1_.mc_counter,_loc1_.mc_counter,{type:type});
  91.             _loc1_.mc_counter += 1;
  92.             _loc1_.targets_counter = 25;
  93.          }
  94.          else
  95.          {
  96.             _loc1_.targets_counter -= 1;
  97.          }
  98.          if(_loc1_._xmouse > 430)
  99.          {
  100.             _loc1_.sight_mc.cursor._visible = true;
  101.             _loc1_.sight_mc.sight._visible = false;
  102.          }
  103.          else
  104.          {
  105.             _loc1_.sight_mc.cursor._visible = false;
  106.             _loc1_.sight_mc.sight._visible = true;
  107.          }
  108.          var _loc3_ = (- _loc1_.sight_mc._x) * (_loc1_.back_width - _loc1_.scr_width) / _loc1_.scr_width + 60 - _loc1_.targets_holder_mc._x;
  109.          _loc1_.targets_holder_mc._x += _loc3_ / 4;
  110.          if(_loc1_.targets_holder_mc._x < -40)
  111.          {
  112.             _loc1_.targets_holder_mc._x = -40;
  113.          }
  114.          for(var _loc2_ in _loc1_.targets_holder_mc)
  115.          {
  116.             _loc1_.targets_holder_mc[_loc2_].Update();
  117.          }
  118.          _loc1_.Timer.Update();
  119.       }
  120.       updateAfterEvent();
  121.    };
  122. };
  123. _root.InitLevel();
  124. stop();
  125.